home *** CD-ROM | disk | FTP | other *** search
- From: kanze@gabi.gabi-soft.fr (J. Kanze)
- Message-ID: <KANZE.96Feb9161600@gabi.gabi-soft.fr>
- X-Original-Date: 09 Feb 1996 15:16:00 GMT
- Path: in1.uu.net!bounce-back
- Date: 09 Feb 96 15:43:22 GMT
- Approved: fjh@cs.mu.oz.au
- Newsgroups: comp.std.c++
- Subject: Re: Give operator. a chance
- Organization: GABI Software, Sarl.
- References: <311535F1.562A@et.se>
- In-Reply-To: Dan Holmsand's message of 05 Feb 96 04:00:46 GMT
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBFAgUBMRtrpuEDnX0m9pzZAQH0uQF9H0zDjldcwpS2mEsNcJNT6P+XaNvHhAl1
- z9PhJhSa112VM2Erz5A1VFSAl5EDU9o6
- =bGak
-
- In article <311535F1.562A@et.se> Dan Holmsand <dan@et.se> writes:
-
- > > Dan Holmsand <dan@et.se> writes:
- > > >Is operator.() banned from the standards discussion?
- >
- > I'm really sorry for reopening this old wound, but many thanks anyway
- > for all the answers.
- >
- > My reason for asking was my own "discovery" that the STL containers and
- > algorithms are clearly overrated - sure, they are very efficient indeed
- > for simple objects with trivial constructors. However, if you consider
- > a vector<vector<string> >, and insert a new element at the beginning of
- > the outer vector, the resulting code is clearly less than efficient
- > (copy constructing all the strings of all the vectors is everything
- > but efficient).
- >
- > That's why I was hoping for smart references to come to the rescue when
- > needed, say by redefining the original vector as
- > vector<smart_ref<vector<string> > >, to gain the speed benefit of a
- > faster copy constructor, while not having to rewrite all the code
- > involved.
-
- If this turns out to be important, there is nothing in the standard to
- prevent the vector class from implementing copy and assignment using
- copy on write, exactly as will probably happen in most implementations
- of string (where copy and assignment *are* expected to be frequent
- operations).
-
- I would suggest, however, that in the above case, you are simply not
- using the appropriate container. Perhaps what you need is a list<
- vector< string > >. The whole purpose of having different types of
- containers is that each represents a distinct tradeoff.
- --
- James Kanze (+33) 88 14 49 00 email: kanze@gabi-soft.fr
- GABI Software, Sarl., 8 rue des Francs Bourgeois, 67000 Strasbourg, France
- Conseils, itudes et rialisations en logiciel orienti objet --
- -- A la recherche d'une activiti dans une region francophone
- ---
- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
- Contact address: std-c++-request@ncar.ucar.edu. Moderation policy:
- http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]
-